/**
 * Project Name:swt-hello <br/>
 * File Name:App.java <br/>
 * Package Name:com.ftu.z <br/>
 */
package com.ftu.swt.basic1;

import java.awt.BorderLayout;
import java.awt.Frame;

import javax.swing.JButton;
import javax.swing.JPanel;

import org.eclipse.swt.SWT;
import org.eclipse.swt.awt.SWT_AWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;


/**
 * <p>  </p>
 * @version 1.0 2018年11月22日 mq 修改内容:初版
 */
public class UsingSwing {
    public static void main(String[] args) {
        final Display display = Display.getDefault();
        final Shell shell1 = new Shell(display);
        shell1.setText("shell1");
        shell1.setBounds(100, 100, 600, 400);
        
        Button btn = new Button(shell1, SWT.NONE);
        btn.setText("swt button");
        btn.setBounds(10, 120, 100, 20);
        
        
        Composite composite = new Composite(shell1, SWT.EMBEDDED);
        composite.setBounds(0, 0, 200, 100);
        
        Frame frame = SWT_AWT.new_Frame(composite);
        frame.setLayout(new BorderLayout());
        JPanel panel = new JPanel();
        panel.setLayout(null);
        frame.add(panel, BorderLayout.CENTER);
        JButton button = new JButton();
        button.setBounds(10, 10, 100, 20);
        button.setText("Swing button");
        panel.add(button);
        
        
        shell1.open();
        while(!shell1.isDisposed()) {
            if(!display.readAndDispatch()) {
                display.sleep();
            }
        }
        display.dispose();
        
    }

}
